package org.inspursc.s0517.health.evaluation.dao;

import org.inspursc.s0517.health.evaluation.entity.AnRadio;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;

/**
 * @author B_Dream
 * @date 2018/6/6 16:37
 */
public interface AnRadioDao extends JpaRepository<AnRadio, Integer> {


    /**
     * 查找所属用户的问卷
     *
     * @param suId
     * @param perId
     * @return
     */
    List<AnRadio> findAllBySurveyIdAndPersonnelId(Integer suId, Integer perId);

    List<AnRadio> findAllByHealthResultId(Integer suAnswerId);

    @Modifying
    @Query(value = "DELETE from t_health_record where health_result_id= ?1")
    Integer deleteByHealthResultId(@Param("resultId") Integer resultId);
}
